package com.ross.mode;

import com.ross.mode.store.ICommondity;
import com.ross.mode.store.impl.CardCommodityService;
import com.ross.mode.store.impl.CouponCommodityService;
import com.ross.mode.store.impl.GoodsCommodityService;

/**
 * @version 1.0.0
 * @className: StoreFactory
 * @description:  创建商店工厂
 * @author: zhangjunfa
 * @date: 2023/3/27 16:32
 */
public class StoreFactory {
    public ICommondity getCommondityService(Integer commodityType){
        if (null == commodityType) {
            return null;
        }
        if (1 == commodityType) {
            return new CouponCommodityService();
        }
        if (2 == commodityType) {
            return new GoodsCommodityService();
        }
        if (3 == commodityType) {
            return new CardCommodityService();
        }
        throw new RuntimeException("不存在的商品服务类型");
    }
}
